package org.emet.dao;
import org.emet.entity.biz.RefuelHist;
import org.emet.jee.core.dao.Page;
import org.emet.jee.core.dao.arch.ArchDataSourceBaseDao;
import org.emet.service.dto.RefuelHistCriteria;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
@Repository
public class RefuelHistDao extends ArchDataSourceBaseDao<RefuelHist, Long> {
public Page<RefuelHist> search(Page<RefuelHist> page, RefuelHistCriteria criteria) {
Criteria c = getSession().createCriteria(RefuelHist.class);
NonEmptyValueHashMap<String, Object> propertyNameValues = new NonEmptyValueHashMap<String, Object>();
propertyNameValues.put("vehicleId",criteria.getVehicleId());
propertyNameValues.put("fuelUnitPrice",criteria.getFuelUnitPrice());
propertyNameValues.put("unit",criteria.getUnit());
propertyNameValues.put("quantity",criteria.getQuantity());
propertyNameValues.put("date",criteria.getDate());
propertyNameValues.put("fillingStation",criteria.getFillingStation());
propertyNameValues.put("remark",criteria.getRemark());
c.add(Restrictions.allEq(propertyNameValues));
page.setOrderBy("id");
page.setOrder("desc");
return findPage(page, c);
}
}
